//
//  Router.swift
//  SwiftuiZsa
//
//  Created by hccc on 2023/11/15.
//

import Foundation
import SwiftUI
//import SwiftyJSON

// MARK: - ----------------------------------RouterDestination


// MARK: - ----------------------------------SheetInfo


// MARK: - ----------------------------------Router
@MainActor
class Router: BaseLogic {
    
    @Published var path = [RouterDestination]()
    
    public func open(_ url: String) {
        guard let url = URL(string: url) else {
            return
        }
        UIApplication.shared.open(url)
    }
    
    public func to(name: RouterDestination) {
        path.append(name)
    }
    
    public func back() {
        path.removeLast()
    }
    
    public func backToRoot() {
        path.removeLast(path.count)
    }
}


